3.3.17 \(\int \frac {(c+d x)^2}{x (a+b x)} \, dx\) [217]

Optimal. Leaf size=42 \[ \frac {d^2 x}{b}+\frac {c^2 \log (x)}{a}-\frac {(b c-a d)^2 \log (a+b x)}{a b^2} \]

[Out]

d^2*x/b+c^2*ln(x)/a-(-a*d+b*c)^2*ln(b*x+a)/a/b^2

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 42, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, integrand size = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.056, Rules used = {84} \begin {gather*} -\frac {(b c-a d)^2 \log (a+b x)}{a b^2}+\frac {c^2 \log (x)}{a}+\frac {d^2 x}{b} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c + d*x)^2/(x*(a + b*x)),x]

[Out]

(d^2*x)/b + (c^2*Log[x])/a - ((b*c - a*d)^2*Log[a + b*x])/(a*b^2)

Rule 84

Int[((e_.) + (f_.)*(x_))^(p_.)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Int[ExpandIntegrand[(
e + f*x)^p/((a + b*x)*(c + d*x)), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && IntegerQ[p]

Rubi steps

\begin {align*} \int \frac {(c+d x)^2}{x (a+b x)} \, dx &=\int \left (\frac {d^2}{b}+\frac {c^2}{a x}-\frac {(-b c+a d)^2}{a b (a+b x)}\right ) \, dx\\ &=\frac {d^2 x}{b}+\frac {c^2 \log (x)}{a}-\frac {(b c-a d)^2 \log (a+b x)}{a b^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 42, normalized size = 1.00 \begin {gather*} \frac {a b d^2 x+b^2 c^2 \log (x)-(b c-a d)^2 \log (a+b x)}{a b^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(c + d*x)^2/(x*(a + b*x)),x]

[Out]

(a*b*d^2*x + b^2*c^2*Log[x] - (b*c - a*d)^2*Log[a + b*x])/(a*b^2)

________________________________________________________________________________________

Maple [A]
time = 0.07, size = 55, normalized size = 1.31

method result size
norman \(\frac {d^{2} x}{b}+\frac {c^{2} \ln \left (x \right )}{a}-\frac {\left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \ln \left (b x +a \right )}{a \,b^{2}}\) \(54\)
default \(\frac {d^{2} x}{b}+\frac {\left (-a^{2} d^{2}+2 a b c d -b^{2} c^{2}\right ) \ln \left (b x +a \right )}{b^{2} a}+\frac {c^{2} \ln \left (x \right )}{a}\) \(55\)
risch \(\frac {d^{2} x}{b}+\frac {c^{2} \ln \left (-x \right )}{a}-\frac {a \ln \left (b x +a \right ) d^{2}}{b^{2}}+\frac {2 \ln \left (b x +a \right ) c d}{b}-\frac {\ln \left (b x +a \right ) c^{2}}{a}\) \(63\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*x+c)^2/x/(b*x+a),x,method=_RETURNVERBOSE)

[Out]

d^2*x/b+(-a^2*d^2+2*a*b*c*d-b^2*c^2)/b^2/a*ln(b*x+a)+c^2*ln(x)/a

________________________________________________________________________________________

Maxima [A]
time = 0.39, size = 53, normalized size = 1.26 \begin {gather*} \frac {d^{2} x}{b} + \frac {c^{2} \log \left (x\right )}{a} - \frac {{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left (b x + a\right )}{a b^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/x/(b*x+a),x, algorithm="maxima")

[Out]

d^2*x/b + c^2*log(x)/a - (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*log(b*x + a)/(a*b^2)

________________________________________________________________________________________

Fricas [A]
time = 1.32, size = 53, normalized size = 1.26 \begin {gather*} \frac {a b d^{2} x + b^{2} c^{2} \log \left (x\right ) - {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left (b x + a\right )}{a b^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/x/(b*x+a),x, algorithm="fricas")

[Out]

(a*b*d^2*x + b^2*c^2*log(x) - (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*log(b*x + a))/(a*b^2)

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 73 vs. \(2 (34) = 68\).
time = 0.45, size = 73, normalized size = 1.74 \begin {gather*} \frac {d^{2} x}{b} + \frac {c^{2} \log {\left (x \right )}}{a} - \frac {\left (a d - b c\right )^{2} \log {\left (x + \frac {a b c^{2} + \frac {a \left (a d - b c\right )^{2}}{b}}{a^{2} d^{2} - 2 a b c d + 2 b^{2} c^{2}} \right )}}{a b^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)**2/x/(b*x+a),x)

[Out]

d**2*x/b + c**2*log(x)/a - (a*d - b*c)**2*log(x + (a*b*c**2 + a*(a*d - b*c)**2/b)/(a**2*d**2 - 2*a*b*c*d + 2*b
**2*c**2))/(a*b**2)

________________________________________________________________________________________

Giac [A]
time = 1.03, size = 55, normalized size = 1.31 \begin {gather*} \frac {d^{2} x}{b} + \frac {c^{2} \log \left ({\left | x \right |}\right )}{a} - \frac {{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left ({\left | b x + a \right |}\right )}{a b^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/x/(b*x+a),x, algorithm="giac")

[Out]

d^2*x/b + c^2*log(abs(x))/a - (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*log(abs(b*x + a))/(a*b^2)

________________________________________________________________________________________

Mupad [B]
time = 0.39, size = 49, normalized size = 1.17 \begin {gather*} \frac {d^2\,x}{b}-\ln \left (a+b\,x\right )\,\left (\frac {c^2}{a}+\frac {a\,d^2}{b^2}-\frac {2\,c\,d}{b}\right )+\frac {c^2\,\ln \left (x\right )}{a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c + d*x)^2/(x*(a + b*x)),x)

[Out]

(d^2*x)/b - log(a + b*x)*(c^2/a + (a*d^2)/b^2 - (2*c*d)/b) + (c^2*log(x))/a

________________________________________________________________________________________